/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.gamecenter.sdk.login.plugin.profile.a;

import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.text.TextUtils;
import com.qihoo.gamecenter.sdk.common.IDispatcherCallback;
import com.qihoo.gamecenter.sdk.common.g.b;
import com.qihoo.gamecenter.sdk.login.plugin.h.e;
import com.qihoo.gamecenter.sdk.login.plugin.h.f;
import com.qihoo.gamecenter.sdk.login.plugin.h.g;
import org.json.JSONException;
import org.json.JSONObject;

public class a implements g.b {
    private Context a;

    public a(Context paramContext) {
        this.a = paramContext;
    }

    public void a(Context paramContext, Intent paramIntent, IDispatcherCallback paramIDispatcherCallback) {
        e.a("Plugin.Profile.GetUserInfoTask", new Object[] { "begin GetUserInfoTask... " });
        new AsyncTask(paramIntent, paramIDispatcherCallback) {
            protected String a(Void[] paramArrayOfVoid) {
                String str1 = g.b(a.a(a.this));
                if (TextUtils.isEmpty(str1)) {
                    str2 = f.a(4001, "sdk user is not login");
                    return str2;
                }
                String str2 = com.qihoo.gamecenter.sdk.login.plugin.profile.a.a(a.a(a.this), str1, "q",
                        com.qihoo.gamecenter.sdk.login.plugin.h.a.a(this.a));
                String str3 = com.qihoo.gamecenter.sdk.login.plugin.d.a.a(a.a(a.this), str2);
                return str3;
            }

            protected void a(String paramString) {
                e.a("Plugin.Profile.GetUserInfoTask", new Object[] { "GetUserInfoTask result is" + paramString });
                if (!(TextUtils.isEmpty(paramString)))
                    try {
                        JSONObject localJSONObject1 = new JSONObject(paramString);
                        int i = localJSONObject1.getInt("errno");
                        e.a("Plugin.Profile.GetUserInfoTask", new Object[] { "result  is " + paramString });
                        e.a("Plugin.Profile.GetUserInfoTask", new Object[] { "errno  is " + i });
                        if (i == 0) {
                            JSONObject localJSONObject2 = localJSONObject1.getJSONObject("data");
                            if (localJSONObject2 != null) {
                                String str1 = localJSONObject2.optString("nickname", null);
                                String str2 = localJSONObject2.optString("head_pic", null);
                                e.a("Plugin.Profile.GetUserInfoTask", new Object[] { "GetUserInfoTask nickname  is ",
                                        str1 });
                                e.a("Plugin.Profile.GetUserInfoTask", new Object[] { "GetUserInfoTask head_pic  is ",
                                        str2 });
                            }
                        }
                    } catch (JSONException localJSONException) {
                        paramString = f.a(400, "http request exception");
                    }
                else
                    paramString = f.a(400, "http request exception");
                this.b.onFinished(paramString);
            }
        }.execute(new Void[0]);
    }
}